package com.lfg.message.delay.message.demo.delay.dl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author lfg
 * @version v1.0
 */
@Component
public class Consumer1 {

    private static final Logger log = LoggerFactory.getLogger(Consumer1.class);

    @RabbitListener(queues = "queue-name")
    public void consume(Message message) {
        try {
            log.info("正在消费消息---{}", new String(message.getBody()));
        } catch (Exception e) {
            //注意进行异常处理，默认当出现异常时，消息将会被 再次立即重新消费
        }
    }
}
